﻿
using MassTransit;
using Microsoft.EntityFrameworkCore;
using SagaOrders.Application.Data.Entities;
using SagaOrders.Application.Saga;
using SagaOrders.Application.StateMachine;


namespace SagaOrders.Application.Data
{
    public class OrdersDbContext:DbContext
    {
        public DbSet<Order> orders { get; set; } = null!;
        public DbSet<OrderState> OrderStates { get; set; } = null!;
        public OrdersDbContext(DbContextOptions<OrdersDbContext> options)
            :base(options)
        {
            
        }

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            modelBuilder.ApplyConfiguration(new OrderStateMap());

            base.OnModelCreating(modelBuilder);

            
            modelBuilder.AddInboxStateEntity();
            modelBuilder.AddOutboxStateEntity();
            modelBuilder.AddOutboxMessageEntity();
        }
    }
}
